﻿@model Syncar.Web.FrontEnd.Models.UploadImageModel
@using Syncar.Web.FrontEnd.Helpers;
@{
    ViewBag.Title = "Image uploader";
}

@section Scripts
{
<script type="text/javascript">
    $(document).ready(function () {
        initSelect();
    });
</script>
}
<h2>Upload an image</h2>
@using (Html.BeginForm("UploadImage", Url.RequestContext.RouteData.Values["controller"].ToString(), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.HiddenFor(model => model.EntityID)
    @Html.HiddenFor(model => model.X)
    @Html.HiddenFor(model => model.Y)
    @Html.HiddenFor(model => model.Width)
    @Html.HiddenFor(model => model.Height)
    @Html.HiddenFor(model => model.Flickr)
    <div id="upload-choices">
        <div class="editor-row">
            <div class="editor-label">
                @Html.EditorFor(model => model.IsUrl)
                @Html.LabelFor(model => model.Url)
            </div><div class="editor-field">
                @Html.EditorFor(model => model.Url)
                @Html.ValidationMessageFor(model => model.Url)
            </div>
        </div>
        <div class="editor-row">
            <div class="editor-label">
                @Html.EditorFor(model => model.IsFlickr)
                @Html.LabelFor(model => model.Flickr)
            </div><div class="editor-field">
                @Html.Editor("FlickrQuery")
                @Html.ValidationMessageFor(model => model.Flickr)
            </div>
        </div>
        <div class="editor-row">
            <div class="editor-label">
                @Html.EditorFor(model => model.IsFile)
                @Html.LabelFor(model => model.File)
            </div><div class="editor-field">
                @Html.FileFor(model => model.File)
                @Html.ValidationMessageFor(model => model.File)
            </div>
        </div>
        <div class="editor-row">
            @Html.ValidationSummary(true)
        </div>
    </div>
    <div id="upload-cut">
        <img alt="Field for image cutting" id="preview" src="@Url.Content("~/Content/images/empty.png")" />
    </div>
    <div class="clear">
        <button type="submit">Upload</button>
    </div>
}